
import java.io.InputStream;
import java.math.BigDecimal;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import dao.EmployeeMapper;
import entity.Employee;

public class M {
	public static void main(String[] args) throws Exception {
		InputStream in=M.class.getResourceAsStream("/mybatis-cfg.xml");
		SqlSessionFactory fac=new SqlSessionFactoryBuilder().build(in);
		SqlSession session=fac.openSession();
		EmployeeMapper  mapper=session.getMapper(EmployeeMapper.class);
		Employee e=new Employee();
		
		e.setId(18);
		e.setName("laoliu");
		e.setSalary(new BigDecimal("20000"));
		e.setDeptno(20);
		mapper.insertEmployee(e);
		System.out.println("nnnn");
		session.commit();
		session.close();
		
	
	}

}
